package com.leapp.sk.ui.fragment

import android.os.Bundle
import cc.vv.lklibrary.log.LogOperate
import com.example.mvp.adapter.NewBannerAdpter
import com.example.mvp.bean.BannerDataEntity
import com.example.mvp.binder.BaseDataBinder
import com.example.mvp.fragment.BaseFragmentMVP
import com.example.util.DetailImgurlsUtilMove
import com.example.util.ISTECHER
import com.leapp.sk.R
import com.leapp.sk.bean.TextImageEntity
import com.leapp.sk.binder.FindDataBinder
import com.leapp.sk.viewdelegate.ApplicationDelegate

/**
 * 应用
 * @author  chaohaipeng  on 2018/7/25.
 */
class ApplicationFragment : BaseFragmentMVP<ApplicationDelegate>() {
    override fun initData() {
        val mutableListOf = mutableListOf<TextImageEntity>()
        initFunData(mutableListOf)
        viewDelegate.initFunction(mutableListOf)
        val bannerList = ArrayList<BannerDataEntity>()
        bannerList.add(BannerDataEntity())
        viewDelegate.initBanner(bannerList)
    }

    override fun onDestroy() {
        super.onDestroy()
        viewDelegate?.stopRuning()
    }
    /**
     * 初始化常用功能适配器
     */
    fun initFunData(data: MutableList<TextImageEntity>) {
        val textImageEntityN = TextImageEntity()
        textImageEntityN.content = resources.getString(R.string.string_application_class_notify)
        textImageEntityN.icon = R.mipmap.icon_class_notify
        val textImageEntityT = TextImageEntity()
        textImageEntityT.content = resources.getString(R.string.string_application_parenting_notify)
        textImageEntityT.icon = R.mipmap.icon_parenting_task
        val textImageEntityA = TextImageEntity()
        textImageEntityA.content = resources.getString(R.string.string_application_class_album)
        textImageEntityA.icon = R.mipmap.icon_class_album
        val textImageEntityJ = TextImageEntity()
        if (ISTECHER){
            textImageEntityJ.content = resources.getString(R.string.string_application_join_examine)
            textImageEntityJ.icon = R.mipmap.icon_join_examine
        }else{
            textImageEntityJ.content = resources.getString(R.string.string_application_archives)
            textImageEntityJ.icon = R.mipmap.icon_baby_file
        }
        val textImageEntityL = TextImageEntity()
        textImageEntityL.content = resources.getString(R.string.string_application_join_leave)
        textImageEntityL.icon = R.mipmap.icon_leave
        data.add(textImageEntityN)
        data.add(textImageEntityT)
        data.add(textImageEntityA)
        data.add(textImageEntityJ)
        data.add(textImageEntityL)
    }


    override fun initView(p0: Bundle?) {
        viewDelegate.setTitle(activity.resources.getString(R.string.app_application))
    }

    override fun bindEvenListener() {

    }

    override fun getDelegateClass(): Class<ApplicationDelegate> {
        return ApplicationDelegate::class.java
    }

    override fun getDataBinder(): BaseDataBinder<*, *> {
        return FindDataBinder()
    }

}